#!/bin/sh
 
##Build script for Darwin Streaming Server


OSNAME=`uname`
HARDWARENAME=`uname -m`
 
PLAT=$OSNAME.$HARDWARENAME

echo "MTAPI "
echo "-----------------------"


case $PLAT in

	Linux.i586 | \
	Linux.i686)
        echo "Configuring for the "$OSNAME" "$HARDWARENAME" platform"
		CPLUS=gcc
		CCOMP=gcc
		LINKER='gcc'
 		MAKE=make
 		
		COMPILER_FLAGS="-D_REENTRANT -D__USE_POSIX -D__linux__ -pipe"
        INCLUDE_FLAG="-include"
		
		CORE_LINK_LIBS="-lpthread -ldl -lstdc++ -lm -lcrypt"

		SHARED=-shared
		MODULE_LIBS=
		
		if [ -f /usr/include/socketbits.h ]; then
			NEED_SOCKETBITS=1
			export NEED_SOCKETBITS
		fi
		;;

	*)
		echo "I don't know your platform. I'll assume this is a Linux x86 platform."
		echo "Please edit the BuildServer script & PlatformHeader.h to add your platform."
		CPLUS=gcc
		CCOMP=gcc
		LINKER='egcs'
 		MAKE=make
 		
		COMPILER_FLAGS=-D__linux__
        INCLUDE_FLAG="-include"

		CORE_LINK_LIBS="-lpthread -ldl -lm -lcrypt"

		SHARED=-shared
		MODULE_LIBS=
		
		if [ -f /usr/include/socketbits.h ]; then
			NEED_SOCKETBITS=1
			export NEED_SOCKETBITS
		fi
		;;
esac


export CPLUS
export CCOMP
export LINKER
export COMPILER_FLAGS
export INCLUDE_FLAG
export CORE_LINK_LIBS
export SHARED
export MODULE_LIBS

echo Building Angora for $PLAT with $CPLUS  Start

echo Building tgmlog for $PLAT with $CPLUS
cd ./utils/tgmlog/
$MAKE -f Makefile $*
cd ../..

echo Building CommonUtilitiesLib for $PLAT with $CPLUS
cd ./utils/CommonUtilitiesLib/
$MAKE -f Makefile $*
cd ../..

echo Building tgmwine for $PLAT with $CPLUS
cd ./utils/tgmwine/
$MAKE -f Makefile $*
cd ../..

echo Building tgmrpc for $PLAT with $CPLUS
cd ./tangram/trpc/
$MAKE -f Makefile $*
cd ../..

echo Building scm_client for $PLAT with $CPLUS
cd ./tangram/scm/scm_client/
$MAKE -f Makefile $*
cd ../../..

echo Building rpcrt4 for $PLAT with $CPLUS
cd ./tangram/rpcrt4/
$MAKE -f Makefile $*
cd ../..

echo Building ole32 for $PLAT with $CPLUS
cd ./tangram/uuid/
$MAKE -f Makefile $*
cd ../..

echo Building ole32 for $PLAT with $CPLUS
cd ./tangram/ole32/
$MAKE -f Makefile $*
cd ../..

echo Building scm_daemon for $PLAT with $CPLUS
cd ./tangram/scm/scm_daemon/
$MAKE -f Makefile $*
cd ../../..

echo Building client for $PLAT with $CPLUS
cd ./tests/TalkToStranger/client/
$MAKE -f Makefile $*
cd ../../..

echo Building server for $PLAT with $CPLUS
cd ./tests/TalkToStranger/server/
$MAKE -f Makefile $*
cd ../../..

echo Building proxystub for $PLAT with $CPLUS
cd ./tests/TalkToStranger/ps/
$MAKE -f Makefile $*
cd ../../..

echo Building WIDL for $PLAT with $CPLUS
cd ./tools/widl/widl
$MAKE -f Makefile $*
cd ../../..

echo Building regsvr32 for $PLAT with $CPLUS
cd ./tools/regsvr32
$MAKE -f Makefile $*
cd ../..


echo -------------------------------------
echo Building Angora for $PLAT with $CPLUS  Complete


#if [ "$*" = "install" ] ; then
#fi


